package com.derbysoft.dswitch.adapter.ihg.common.aop.exception2error.handler;

import com.derbysoft.dswitch.adapter.ihg.common.core.exception.AdapterWrappedException;
import com.derbysoft.modules.exception.returnvalue.Exception2ReturnValueHandlerRegistry;
import com.derbysoft.modules.exception.returnvalue.RegistryBasedException2ReturnValueHandler;
import org.aopalliance.intercept.MethodInvocation;

public class AdapterWrappedExceptionHandler extends RegistryBasedException2ReturnValueHandler<AdapterWrappedException> {

    public AdapterWrappedExceptionHandler(Exception2ReturnValueHandlerRegistry registry) {
        super(registry);
    }

    protected Throwable getTargetException(AdapterWrappedException adapterWrappedException) {
        return adapterWrappedException.getCause();
    }

    protected Object postHandle(Object result, AdapterWrappedException adapterWrappedException, MethodInvocation methodInvocation) {
        return result;
    }
}
